<template>
<div>
  <h1>试卷答题卡</h1>
  <div class="container">
    <div class="header">
      <p>
        2018-2019学年第二学期阶段性检测
      </p>
      <p>
        高一物理
      </p>
    </div>
    <div class="middle">
      <div class="left">
        <p @click="handle3({num:'num1',change:1})">添加准考证号位数</p>
        <p @click="handle3({num:'num1',change:-1})">减少准考证号位数</p>
        <p @click="handle3({num:'num2',change:1})">添加客观题数量</p>
        <p @click="handle3({num:'num2',change:-1})">减少客观题数量</p>
        <p @click="handle3({num:'num3',change:1})">增加解答题数量</p>
        <p @click="handle3({num:'num3',change:-1})">减少解答题数量</p>
      </div>

      <div class="right">

        <table class="table1">

          <tr>
            <th colspan="8" >准考证号</th>
          </tr>
          <tr class="tr1">
            <td v-for="i in num1">
              &nbsp;
            </td>
          </tr>
          <tr v-for="i in 10">
            <td v-for="j in num1">[{{i-1}}]</td>

          </tr>

        </table>
      </div>

    </div>
    <div class="middle2">
      <p class="p2">客观题(1-9为单选题;10-16为多选题)</p>
      <div class="div2">
        <table>
          <tr>
            <td v-for="j in count(num2)">
              <table class="table3">
                <tr v-for="i in 4" v-if="(j-1)*4+i<=num2">
                  <td>{{(j-1)*4+i}}</td>
                  <td>[A]</td>
                  <td>[B]</td>
                  <td>[C]</td>
                  <td>[D]</td>
                </tr>
              </table>
            </td>
          </tr>
        </table>
      </div>
    </div>
    <div v-for="j in num3">
      <p class="p2">解答题</p>
      <div class="footer">

      </div>
    </div>

  </div>
</div>
</template>
<script>
export default {
  methods:{
    count(i){
      return Math.floor(i/4)+1
    },
    handle3(obj){
      console.log(obj)
      if (obj.change===-1 && this[obj.num]===0){
        this.$message.warning('当前数值已为0')
      }else {
        this[obj.num]+=obj.change;
      }
    }
  },
  data(){
    return{
      num1:8,
      num2:15,
      num3:1
    }
  }
}
</script>
<style scoped>

  .footer{
    display: inline-block;
    width: 100%;
    border: 1px solid black;
    min-height: 600px;
  }
  .p2{
    margin-left: 10px;line-height: 8px;font-weight: 600;
  }
  .table3{
    margin:5px 5px 20px 12px;
    font-size: 5px;
    letter-spacing: 1px;
  }
  .table3 tr{

  }
  .div2{
    border: 1px solid black;
  }
  .middle2{
    margin-top: 20px;

    min-width: 100%;
    min-height: 150px;
    height: 100px;
  }
  .header{
    font: normal 25px 宋体;
    line-height: 10px;
    text-align: center;
  }
  .middle{
    min-height: 300px;
    /*border: 1px solid black;*/
  }
  .table1{
    border-collapse:collapse;
  }
  .table1 th{
    text-align: center;
    font-size: 15px;
    font-family: '宋体';
  }
  .tr1{
    border: 1px solid black;
    border-left: none;
  }
  .table1 td {
    border:solid 1px black;
    font-size: 5px;
    padding: 2px 5px;
    letter-spacing: 3px;
    min-width: 30px;
    text-align: center;
    border-left: none;;
    border-top: none;
    border-bottom: none;
  }

  .left{
    /*border: 1px black solid;*/
    display: inline-block;
    margin-left: 20px;
    text-decoration: underline black;
    line-height: 20px;
    width: 400px;
  }
  .right{
    margin-top: 20px;
    border: 1px black solid;
    display: inline-block;
    line-height: 20px;
    float: right;
    margin-right: 20px;
  }
  .container{
    padding: 10px 50px;
    display: inline-block;
    border: 1px black solid;
    min-height: 1043px;
    min-width: 836px;
  }
</style>
